@using OrchardCore.Forms.Models
@model ShapeViewModel<TextAreaPart>
@{
    var formElementPart = Model.Value.ContentItem.As<FormElementPart>();
    var formInputElementPart = Model.Value.ContentItem.As<FormInputElementPart>();
    var elementId = formElementPart.Id;
    var fieldName = formInputElementPart.Name;
    var fieldId = !string.IsNullOrEmpty(elementId) ? elementId : !string.IsNullOrEmpty(fieldName) ? Html.GenerateIdFromName(fieldName) : default(string);
    var fieldValue = Model.Value.DefaultValue?.Trim();
    var fieldClass = "form-control";

    if (ViewData.ModelState.TryGetValue(fieldName, out var fieldEntry))
    {
        fieldValue = fieldEntry.AttemptedValue;
        if (fieldEntry.Errors.Count > 0)
        {
            fieldClass = "form-control input-validation-error";
        }
    }
}
<textarea id="@fieldId" name="@fieldName" class="@fieldClass" placeholder="@Model.Value.Placeholder">@fieldValue</textarea>